package br.com.advance.automacao.services.impl;

import java.util.Date;
import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import br.com.advance.automacao.dao.EventoDao;
import br.com.advance.automacao.dto.ContabilizacaoEventos;
import br.com.advance.automacao.model.Evento;
import br.com.advance.automacao.services.EthernetIp4JService;
import br.com.advance.automacao.services.EventoService;

@Service
@Transactional("transactionManager")
public class EventoServiceImpl implements EventoService {

	private static final Logger logger = Logger.getLogger(EventoServiceImpl.class);

	@Autowired
	private EventoDao eventoDao;

	@Autowired
	private EthernetIp4JService ethernetIp4JService;

	@Override
	public Evento criar(Evento clp) {
		return eventoDao.create(clp);
	}

	@Override
	public Evento buscarPorId(Long id) {
		return eventoDao.findById(id);
	}

	@Override
	public List<Evento> buscarPorFiltro(Long idCLP, Long idTurno, Date dataTurno) {
		return eventoDao.buscarPorFiltro(idCLP, idTurno, dataTurno);
	}
	
	@Override
	public List<ContabilizacaoEventos> buscarContabilizadoPorFiltro(Long idCLP, Long idTurno, Date dataTurno) {
		return eventoDao.buscarContabilizadoPorFiltro(idCLP, idTurno, dataTurno);
	}

	@Override
	public List<Date> buscarDataEventosPorClp(Long idCLP) {
		return eventoDao.buscarDataEventosPorClp(idCLP);
	}

	@Override
	public void deletarEventosPorClpDataTurno(Long idTurno, Date dataEvento,
			Long idCLP) {
		eventoDao.deletarEventosPorClpDataTurno(idTurno, dataEvento, idCLP);
	}

}
